import { createWebHashHistory, createRouter } from "vue-router";
import LoginView from "../pages/login/index.vue";
import Layout from "../components/layout/index.vue";
import { redirectUrl } from "./redirect";

const routes = [
  { path: "/", redirect: "/login" },
  { path: "/login", component: LoginView, meta: { noAuth: true } },
  {
    path: "/",
    component: Layout,
    children: [
      {
        path: "/redirect",
        name: "Redirect",
        meta: {
          title: "Redirect",
          tabActive: "0",
          noAuth: true,
        },
        component: () => import("../pages/redirect/index.vue"),
      },
      {
        path: "/apply/settled_protocol",
        name: "入驻协议",
        meta: {
          title: "入驻协议",
          tabActive: "7",
          noAuth: true,
        },
        component: () => import("../pages/apply/settled_protocol/index.vue"),
      },
      {
        path: "/apply/base_info",
        name: "店铺信息",
        meta: {
          title: "店铺信息",
          tabActive: "7",
          noAuth: true,
        },
        component: () => import("../pages/apply/base_info/index.vue"),
      },
      {
        path: "/apply/business_info",
        name: "经营信息",
        meta: {
          title: "经营信息",
          tabActive: "7",
          noAuth: true,
        },
        component: () => import("../pages/apply/business_info/index.vue"),
      },
      {
        path: "/apply/open_up",
        name: "商家开通",
        meta: {
          title: "商家开通",
          tabActive: "7",
          noAuth: true,
        },
        component: () => import("../pages/apply/open_up/index.vue"),
      },

      {
        path: "/basic/simple_stat",
        name: "概况",
        meta: {
          title: "概况",
          tabActive: "1",
          hideBg: true,
        },
        component: () => import("../pages/basic/simple_stat.vue"),
      },

      {
        path: "/store/annualFee",
        name: "年费缴纳",
        meta: {
          title: "年费缴纳",
          tabActive: "4",
        },
        component: () => import("../pages/store/annualFee/index.vue"),
      },
      {
        path: "/store/coupon",
        name: "优惠券管理",
        meta: {
          title: "优惠券管理",
          tabActive: "4",
        },
        component: () => import("../pages/store/coupon/index.vue"),
      },
      {
        path: "/store/coupon/release",
        name: "发布优惠券",
        meta: {
          title: "发布优惠券",
          tabActive: "4",
          parent: "/store/coupon",
          titleZhCN: "发布优惠券",
          titleEnUS: "Issue Coupon",
          titleKz: "Купон шығару",
          titleRuRU: "Выпустить купон",
        },
        component: () => import("../pages/store/coupon/release.vue"),
      },
      {
        path: "/store/couponRecord",
        name: "优惠券领取记录",
        meta: {
          title: "优惠券领取记录",
          tabActive: "4",
        },
        component: () => import("../pages/store/couponRecord/index.vue"),
      },
      {
        path: "/store/swiperManage",
        name: "轮播图管理",
        meta: {
          title: "轮播图管理",
          tabActive: "4",
          parent: "/store/swiperManage",
          titleZhCN: "轮播图管理",
          titleEnUS: "Banner Management",
          titleKz: "Слайдтарды басқару",
          titleRuRU: "Управление слайдами",
        },
        component: () => import("../pages/store/swiperManage/index.vue"),
      },

      {
        path: "/goods/goods_list",
        name: "商品列表",
        meta: {
          title: "商品列表",
          tabActive: "2",
        },
        component: () => import("../pages/goods/goods_list/index.vue"),
      },
      {
        path: "/goods/goods_release",
        name: "发布商品",
        meta: {
          title: "发布商品",
          titleZhCN: "发布商品",
          titleEnUS: "Publish Product",
          titleKz: "Тауар шығару",
          titleRuRU: "Публикация товара",
          tabActive: "2",
          parent: "/goods/goods_list",
        },
        component: () => import("../pages/goods/goods_list/release.vue"),
      },
      {
        path: "/goods/goods_list/detail",
        name: "商品详情",
        meta: {
          title: "商品详情",
          tabActive: "2",
          parent: "/goods/goods_list",
          titleZhCN: "商品详情",
          titleEnUS: "Product Details",
          titleKz: "Тауар егжей-тегжейі",
          titleRuRU: "Детали товара",
        },
        component: () => import("../pages/goods/goods_list/detail.vue"),
      },
      {
        path: "/goods/discountActivity",
        name: "折扣活动",
        meta: {
          title: "折扣活动",
          tabActive: "2",
        },
        component: () => import("../pages/goods/discountActivity/index.vue"),
      },

      {
        path: "/order/order_lists",
        name: "订单管理",
        meta: {
          title: "订单管理",
          tabActive: "3",
        },
        component: () => import("../pages/order/order_lists/index.vue"),
      },
      {
        path: "/order/order_lists/detail",
        name: "订单详情",
        meta: {
          title: "订单详情",
          tabActive: "3",
          parent: "/order/order_lists",
          titleZhCN: "订单详情",
          titleEnUS: "Order Details",
          titleKz: "Тапсырыс егжей-тегжейі",
          titleRuRU: "Детали заказа",
        },
        component: () => import("../pages/order/order_lists_detail/index.vue"),
      },

      {
        path: "/order/service",
        name: "售后管理",
        meta: {
          title: "售后管理",
          tabActive: "3",
          keepAlive: true
        },
        component: () => import("../pages/order/service/index.vue"),
      },
      {
        path: "/order/service/detail",
        name: "售后管理详情",
        meta: {
          title: "售后管理详情",
          tabActive: "3",
          parent: "/order/service",
          titleZhCN: "退款详情",
          titleEnUS: "Refund Details",
          titleKz: "Қайтару егжей-тегжейі",
          titleRuRU: "Детали возврата",
        },
        component: () => import("../pages/order/service/detail/index.vue"),
      },
      {
        path: "/order/comment",
        name: "评价管理",
        meta: {
          title: "评价管理",
          tabActive: "3",
        },
        component: () => import("../pages/order/comment/index.vue"),
      },
      {
        path: "/store/fundMana",
        name: "资金管理",
        meta: {
          title: "资金管理",
          tabActive: "4",
          hideBg: true,
        },
        component: () => import("../pages/store/fundMana/index.vue"),
      },
      {
        path: "/store/fundMana/detail",
        name: "结算单详情",
        meta: {
          title: "结算单详情",
          tabActive: "4",
          parent: "/store/fundMana",
          titleZhCN: "结算单详情",
          titleEnUS: "Settlement Details",
          titleKz: "Есептеу мәліметі",
          titleRuRU: "Детали счёта",
        },
        component: () => import("../pages/store/fundMana/detail.vue"),
      },
      {
        path: "/store/accountMana",
        name: "账号管理",
        meta: {
          title: "账号管理",
          tabActive: "4",
        },
        component: () => import("../pages/store/accountMana/index.vue"),
      },
      {
        path: "/store/setting",
        name: "店铺设置",
        meta: {
          title: "店铺设置",
          tabActive: "4",
        },
        component: () => import("../pages/store/setting/index.vue"),
      },
      {
        path: "/store/tagSetting",
        name: "标签设置",
        meta: {
          title: "标签设置",
          tabActive: "4",
        },
        component: () => import("../pages/store/tagSetting/index.vue"),
      },
      {
        path: "/store/spec_lists",
        name: "规格设置",
        meta: {
          title: "规格设置",
          tabActive: "4",
        },
        component: () => import("../pages/store/spec_lists/index.vue"),
      },
      {
        path: "/store/tenantAddress",
        name: "商户地址管理",
        meta: {
          title: "商户地址管理",
          tabActive: "4",
        },
        component: () => import("../pages/store/tenantAddress/index.vue"),
      },
      {
        path: "/bill/settlementAccount",
        name: "结算账号管理",
        meta: {
          title: "结算账号管理",
          tabActive: "6",
        },
        component: () => import("../pages/bill/settlementAccount/index.vue"),
      },

      // 统计管理======================================
      {
        path: "/statistics/realtime",
        name: "实时分析",
        meta: {
          title: "实时分析",
          tabActive: "5",
          hideBg: true,
        },
        component: () => import("../pages/statistics/realtime/index.vue"),
      },
      {
        path: "/statistics/trade",
        name: "交易分析",
        meta: {
          title: "交易分析",
          tabActive: "5",
          hideBg: true,
        },
        component: () => import("../pages/statistics/trade/index.vue"),
      },
      {
        path: "/statistics/goods_sale",
        name: "商品分析",
        meta: {
          title: "商品分析",
          tabActive: "5",
          hideBg: true,
        },
        component: () => import("../pages/statistics/goods_sale/index.vue"),
      },
      {
        path: "/statistics/member",
        name: "用户分析",
        meta: {
          title: "用户分析",
          tabActive: "5",
          hideBg: true,
        },
        component: () => import("../pages/statistics/member/index.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
redirectUrl(router);
export default router;
